/****************************************************************************

	COPYRIGHT(C) MAXSI SOFTWARE, JONAS 'SORTIE' TERMANSEN 2008, 2009, 2010

    This file is part of Maxsi Distribution.

    Maxsi Distribution is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Maxsi Distribution is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Maxsi Distribution. If not, see <http://www.gnu.org/licenses/>.

	*/ #include "MaxsiDistributionContributors.h" /*

	If you modify this file, please enter your name below and provide contact
	information in MaxsiDistributionContributors.h. For more information please see
	MaxsiDistributionContributors.h.
	
	Contributors to this file:

	- Jonas 'Sortie' Termansen
	- [your name here]

	MaxsiDistribution.dll
	Distributing since 2008

	MaxsiDistribution001.h
	A SDK Callback Interface!

****************************************************************************/

#ifndef MaxsiDistributionClass_H
#define MaxsiDistributionClass_H

//=============================================================================
// Undef all redirections to previous versions of this interface and make sure
// all the interfaces we refer to are properly versioned here. It doesn't
// matter if these interfaces are not the newest versions, just as long as
// as these def's refer to the used versions.
//=============================================================================
// Maxsi Distribution SDK Callback
#ifdef MaxsiDistributionClass
#undef MaxsiDistributionClass
#endif
#define MaxsiDistributionClass MaxsiDistributionClass001

//=============================================================================
// Maxsi Distribution Interface
//=============================================================================
class	MaxsiDistributionClass
{
public:
	MaxsiDistributionClass();
	~MaxsiDistributionClass();

	//=============================================================================
	//	void*	GetInterface(char* Version);
	//
	//	Returns the Version interface or NULL upon failure.
	//=============================================================================

	typedef void* (__cdecl* type_GetInterface  ) (MESTR* Version) ;
	type_GetInterface GetInterface;

	//=============================================================================
	//	bool	InitializeMaxsiDistribution();
	//
	//	Links to MaxsiDistribution.dll and sets g_MaxsiDistribution. If an error,
	//	occurs the function returns false and the game quits and an error message
	//	is presented. If true, the game can safely continue.
	//=============================================================================

	virtual	bool	InitializeMaxsiDistribution() MDSDKEE_INTERFACE;

	//=============================================================================
	//	bool	InitializeMaxsiDistributionLibrary();
	//
	//	Links to MaxsiDistribution.dll and sets g_MaxsiDistribution. If an error,
	//	occurs the function returns false and the game quits and an error message
	//	is presented. If true, the game can safely continue.
	//=============================================================================

	virtual	bool	InitializeMaxsiDistributionLibrary(int	Binary) MDSDKEE_INTERFACE;

	//=============================================================================
	//	char*	BuildString(unsigned int NumParameters, ...);
	//
	//	Takes the [NumParameters] strings following NumParameters and combine them
	//	to a single string. Delete[] when done using the string.
	//=============================================================================

	virtual	char*	BuildString(unsigned int NumParameters, ...) MDSDKEE_INTERFACE;

	//=============================================================================
	//	bool	str_replace(char* input, char* find, char* replace);
	//
	//	Replaces any occurences of find with replace in input. Changes the input
	//	buffer - so find and replace must be of the same size.
	//=============================================================================

	virtual	bool	str_replace(char* input, char* find, char* replace) MDSDKEE_INTERFACE;

	//=============================================================================
	//	char*	GetWorkingDir(void);
	//
	//	Gets the current working directory.
	//=============================================================================

	virtual	char*	GetWorkingDir(void) MDSDKEE_INTERFACE;

	//=============================================================================
	//	bool	ReportError(const char* Error, bool DontShowNotepad = false);
	//
	//	If not [DontShowNotepad] then quit the game and present the user with [Error]
	//	as text in a notepad file. If [DontShowNotepad] then write the error to the
	//	ingame console.
	//=============================================================================

	virtual	bool	ReportError(const char* Error, bool DontShowNotepad = false) MDSDKEE_INTERFACE;

	//=============================================================================
	//	bool	IngameError(const char* Error);
	//
	//	Writes [Error] to the console.
	//=============================================================================

	virtual	bool	IngameError(const char* Error) MDSDKEE_INTERFACE;

	//=============================================================================
	//	bool	IngameInfo(const char* Error);
	//
	//	Writes [Info] to the console.
	//=============================================================================

	virtual	bool	IngameInfo(const char* Info) MDSDKEE_INTERFACE;

	//=============================================================================
	//	bool	IngameMsg(const char* Msg);
	//
	//	Writes Msg to the console.
	//=============================================================================

	virtual	bool	IngameMsg(const char* Msg) MDSDKEE_INTERFACE;

	//=============================================================================
	//	bool	IngameMsgDebug(const char* Msg);
	//
	//	Writes Msg to the console.
	//=============================================================================

	virtual	bool	IngameMsgDebug(const char* Msg) MDSDKEE_INTERFACE;

	//=============================================================================
	//	char*	IToA(int In);
	//
	//	Converts an 32-bit signed integer to a string
	//=============================================================================

	virtual	char*	IToA(int In) MDSDKEE_INTERFACE;

	//=============================================================================
	//	char*	UIToA(unsigned int In);
	//
	//	Converts an 32-bit unsigned integer to a string
	//=============================================================================

	virtual	char*	UIToA(unsigned int In) MDSDKEE_INTERFACE;

	//=============================================================================
	//	char*	IToA64(__int64 In);
	//
	//	Converts an 64-bit signed integer to a string
	//=============================================================================

	virtual	char*	IToA64(__int64 In) MDSDKEE_INTERFACE;

	//=============================================================================
	//	char*	UIToA(unsigned __int64 In);
	//
	//	Converts an 64-bit unsigned integer to a string
	//=============================================================================

	virtual	char*	UIToA64(unsigned __int64 In) MDSDKEE_INTERFACE;

	//=============================================================================
	//	SHA1_t	CalculateSHA1(char* Buffer, size_t BufferLen);
	//
	//	Calculates a 160-bit SHA1 hash
	//=============================================================================

	virtual	SHA1_t	CalculateSHA1(char* Buffer, size_t BufferLen) MDSDKEE_INTERFACE;

	//=============================================================================
	//	char*	GetSteamUsername();
	//
	//	Detects the Steam Username of the current user.
	//=============================================================================

	virtual	char*	GetSteamUsername() MDSDKEE_INTERFACE;

	//=============================================================================
	//	void	CreateInterfaces();
	//
	//	Creates the g_Maxsi* interfaces/modules used by Maxsi Distribution.
	//=============================================================================

	virtual	void	CreateInterfaces() MDSDKEE_INTERFACE;

	//=============================================================================
	//	char*	GetRegMaxsiRoot();
	//
	//	Returns the registy value of where Maxsi Distribution is installed, or
	//	NULL if not found. Any non-NULL value must be delete[]'d afterwards.
	//=============================================================================

	virtual	char*	GetRegMaxsiRoot() MDSDKEE_INTERFACE;

public:
	HMODULE		MaxsiDistributionLibrary;
	int			iSeekPath;
	int			iDistribution;
	int			iBinFolder;
	int			iBinary;

};

#endif